<?php
    class ResetPasswordDAL{
        //重置密码
        public function resetPassword($uid,$password){
            $query="update tb_account set password=:password where uid=:uid;";
            
            $pdo=myPDO::getInstance();
            $statement=$pdo->prepare($query,array(PDO::ATTR_CURSOR =>PDO::CURSOR_FWDONLY));
            $statement->bindValue(":uid",$uid);
            $statement->bindValue(":password",$password);
            $result=$statement->execute();

            return $result;
        }
        //验证密码
        public function authenticationPassword($uid,$password){
            $query="select count(1) as count from tb_account where uid=:uid and password=:password;";

            $pdo=myPDO::getInstance();
            $statement=$pdo->prepare($query,array(PDO::ATTR_CURSOR =>PDO::CURSOR_FWDONLY));
            $statement->bindValue(":uid",$uid);
            $statement->bindValue(":password",$password);
            if($statement->execute()){
                $result=$statement->fetch(PDO::FETCH_ASSOC);
            }
            
            return $result;
        }
    }
?>